<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../src/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="../../src/css/main.css" />
		<link rel="stylesheet" type="text/css" href="../../libs/leaflet/leaflet.css" />
		<script src="../../libs/leaflet/leaflet.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../libs/leaflet/leaflet.ChineseTmsProviders.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="map"></div>
		<div>
			<div><span>缩放到那个级别:</span><input type="text" id="zoom" placeholder="默认当前等级" /></div>
			<div><span>移动到纬度:</span><input type="text" id="lat" placeholder="默认32.444721222054795" /></div>
			<div><span>移动到经度:</span><input type="text" id="lon" placeholder="默认119.4224873962402" /></div>
			<button type="button" onclick="setView()">设置中心点和缩放级别</button>
		</div>
		<script type="text/javascript"  id="my_script">
			let map = L.map('map', {
				center: [32.444721222054795, 119.4224873962402], // leaflet 所有坐标都是纬度在前,经度在后的
				zoom: 16
			})

			// 地图依赖于leaflet.ChineseTmsProviders.js  他提供4326坐标系的天地图,高德地图等
			let baseLayer = L.tileLayer.chinaProvider('TianDiTu.Normal.Map', {
				maxZoom: 18,
				minZoom: 10
			})
			map.addLayer(baseLayer)
			let labelLayer = L.tileLayer.chinaProvider('TianDiTu.Normal.Annotion', {
				maxZoom: 18,
				minZoom: 10
			})
			map.addLayer(labelLayer)

			function setView() {
				let zoom = document.getElementById("zoom").value ||  map.getZoom();
				let lon = document.getElementById("lon").value ||  119.4224873962402;
				let lat = document.getElementById("lat").value || 32.444721222054795;
				map.setView([lat,lon],zoom)
			}
		</script>
	</body>
</html>
